package com.cq.hd.member.factory;

import java.util.HashMap;
import java.util.Map;

public class WithdrawalFactory {

    private static final Map<Integer, AbstractWithdrawalHandler> STRATEGY_MAP = new HashMap<>();

    public static void register(Integer markType, AbstractWithdrawalHandler strategy) {
        STRATEGY_MAP.put(markType, strategy);
    }

    public static AbstractWithdrawalHandler getWithdrawalHandler(Integer type) {
        AbstractWithdrawalHandler abstractWithdrawalHandler = STRATEGY_MAP.get(type);
        if (abstractWithdrawalHandler == null) {
            throw new RuntimeException("处理类为空");
        }
        return abstractWithdrawalHandler;
    }

}
